﻿$(function(){
	$('.menu_list li').click(function(){
		$('.menu_list li').removeClass('current');
		$(this).addClass('current');
	});	
	
	$('.img_tips').each(function(index, element) {    	
		if($(element).attr('id') !='video_tips'){
			imgTips($(element));
		}		
    });
	
	
	

	$('.del').click(function(){
		$('#dtc,#tc').show();
		$('#tc').css({'margin-left':-$('#tc').width()/2,'margin-top':-$('#tc').height()/2});
	})
	$('.del1').click(function(){
		$('#dtc1,#ttc').show();
		$('#ttc').css({'margin-left':-$('#ttc').width()/2,'margin-top':-$('#ttc').height()/2});
	})
	$('.fh').click(function gb(){
		$('#dtc,#dtc1,#tc,#ttc').hide();
	})



	var hgt = $(window).height(),
	hgt1=document.body.clientHeight;
	$('.del').click(function(){
		if (hgt1<hgt) {
			$('#dtc').show().css({'height':hgt});
			$('#tc').css({'margin-left':-$('#tc').width()/2,'margin-top':-$('#tc').height()/2});
		}else{
			$('#dtc').show().css({'height':hgt1});
			$('#tc').css({'margin-left':-$('#tc').width()/2,'margin-top':-$('#tc').height()/2});
		};
	})
	$('.del1').click(function(){
		if (hgt1<hgt) {
			$('#dtc1').show().css({'height':hgt});
			$('#ttc').css({'margin-left':-$('#ttc').width()/2,'margin-top':-$('#ttc').height()/2});
		}else{
			$('#dtc1').show().css({'height':hgt1});
			$('#ttc').css({'margin-left':-$('#ttc').width()/2,'margin-top':-$('#ttc').height()/2});
		};
	})
	
	
	
	
	
})

function showBox()
{
	var hgt = $(window).height();
	var hgt1=document.body.clientHeight;
	if (hgt1<hgt) 
	{
		$('#dtc').css({'height':hgt});
	}
	else
	{
		$('#dtc').css({'height':hgt1});
	}
	
	$('#tc').css({'margin-left':-$('#tc').width()/2,'margin-top':-$('#tc').height()/2});
		
	$('#dtc,#tc').show();
}


//ajax function
function makeAjax(type,url,data,callback,datatype){

	if(!url){
		alert('路径参数错误');
		return false;
	}
	if(!data){
		alert('数据参数错误');
		return false;
	}
	if(!callback){
		var callback = function(data){
			console.log(data);
		}
	}
	if(!datatype){
		var datatype = 'json';
	}
	if(type == 'get'){
alert("get1");
		$.ajax({
			type:'GET',
			url:url,
			data:data,
			success:function(data){
				callback(data);
			},
			dataType:datatype
		});
	}else if(type == 'post'){
alert(data);
		$.ajax({
			type:'POST',
			url:url,
			data:data,
			success:function(data){
alert("ssss");
				callback(data);
			},
			dataType:datatype
		});
	}
}

// 图片提示
function imgTips(object){
	$(object).hover(function(){
		var url = $(this).find('img').attr('src');
		var top = $(this).offset().top;
		var left = $(this).offset().left;
		var imgTipsBox = $('<div id="imgTipsBox" style="left:'+(left+30)+'px; top:'+(top+30)+'px;"><img src="'+url+'"></div>');
		$(document.body).append(imgTipsBox);
	},function(){
		$('#imgTipsBox').remove();
	})
}
function refreshpage(){
	window.location=window.location;
}